package test4;

import java.util.*;

public class Demo3 {
    static PriorityQueue<Integer> queue = new PriorityQueue<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for (int i = 0; i < N; i++) {
            int T = sc.nextInt();
            String[] arr = new String[T];

            for (int j = 0; j < T; j++) {
                String s = sc.next();
                queue.offer(s.length());
                arr[j] = s;
            }
            System.out.println(judge(arr));
        }
    }

    //判断是 YES 或者 NO
    static String judge(String[] arr) {
        ArrayList<String> list = new ArrayList<>();
        while (!queue.isEmpty()) {
            Integer edge = queue.poll();
            for (String s : arr) {
                if (s.length() >= edge) {
                    String sub = s.substring(0, edge);
                    list.add(sub);
                }
            }
            int os = list.size();//原来长度，包括重复的
            int ns = new HashSet<>(list).size();//去重过后
            list.clear();
            if (os > ns) return "YES";
        }
        return "NO";
    }
}
